//
//  NTESBundleSetting.m
//  Netease
//
//  Created by 王方伟 on 2017/8/24.
//  Copyright © 2017年 wfw. All rights reserved.
//

#import "NTESBundleSetting.h"

@implementation NTESBundleSetting
+ (instancetype)sharedConfig{
    static NTESBundleSetting *instance = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        instance = [[NTESBundleSetting alloc] init];
    });
    return instance;
}

- (NIMNetCallVideoCaptureFormat)videoCaptureFormat{
    id setting = [[NSUserDefaults standardUserDefaults] objectForKey:@"video_capture_format"];
    return setting ? [setting integerValue] : NIMNetCallVideoCaptureFormat420f;
}

- (BOOL)preferHDAudio{
    id setting = [[NSUserDefaults standardUserDefaults] objectForKey:@"videochat_prefer_hd_audio"];
    
    if (setting) {
        return [setting boolValue];
    }
    else {
        return NO;
    }
}

- (NIMAVChatScene)scene{
    id setting = [[NSUserDefaults standardUserDefaults] objectForKey:@"avchat_scene"];
    
    if (setting) {
        return [setting unsignedIntegerValue];
    }else {
        return NIMAVChatSceneDefault;
    }
    
}

- (NSUInteger)bypassVideoMixMode{
    return 0;
//    id setting = [[NSUserDefaults standardUserDefaults] objectForKey:@"bypass_mix_mode"];
//
//    if (setting) {
//        return [setting unsignedIntegerValue];
//    }
//    else {
//        return NIMNetCallBypassStreamingMixModeFloatingRightVertical;
//    }
}

- (NSString *)bypassVideoMixCustomLayoutConfig{
    
    id setting = [[NSUserDefaults standardUserDefaults] objectForKey:@"bypass_mix_layout_config"];
    
    return setting;
}

- (BOOL)bypassStreamingServerRecord{
    id setting = [[NSUserDefaults standardUserDefaults] objectForKey:@"bypass_server_record"];
    
    if (setting) {
        return [setting boolValue];
    }
    else {
        return NO;
    }
}

- (NELPBufferStrategy)preferredBufferStrategy{
    NELPBufferStrategy strategy = (NELPBufferStrategy)[[[NSUserDefaults standardUserDefaults] objectForKey:@"enabled_preferred_buffer_strategy"] integerValue];
    return strategy;
}

- (BOOL)webrtcCompatible{
    id setting = [[NSUserDefaults standardUserDefaults] objectForKey:@"webrtc_compatible"];
    
    if (setting) {
        return [setting boolValue];
    }
    else {
        return NO;
    }
}
@end
